package org.liuhy.jbpm4.property
{
	import mx.binding.utils.BindingUtils;
	import mx.containers.Canvas;
	import mx.containers.HBox;
	import mx.containers.VBox;
	import mx.controls.Label;
	import mx.controls.TextInput;
	import mx.events.FlexEvent;
	
	import org.liuhy.jbpm4.DecisionFlowNode;
	
	public class DecisionProperty extends Canvas
	{
		private var _flowNode:DecisionFlowNode=null;
		private var _lblTitle:Label = new Label;
		public var _txtTitle:TextInput = new TextInput;
		
		private var _lblLanguage:Label = new Label;
		public var _txtLanguage:TextInput = new TextInput;
		
		private var _lblExpr:Label = new Label;
		public var _txtExpr:TextInput = new TextInput;
		
		private var _lblHandlerClass:Label = new Label;
		public var _txtHandlerClass:TextInput = new TextInput;
		
	
		public function DecisionProperty(p_flowNode:DecisionFlowNode)
		{
			
			this._flowNode = p_flowNode;
			this._txtTitle.addEventListener(FlexEvent.PREINITIALIZE,function(event:FlexEvent):void{
				BindingUtils.bindProperty(_txtTitle,"text",_flowNode._textArea,"text");
			});
			
			var _hbox:HBox = new HBox();
			_lblTitle.text = "Name             ";
			_txtTitle.width = 200;
			_hbox.addChild(_lblTitle);
			_hbox.addChild(_txtTitle);
			
			var _hbox1:HBox = new HBox();
			_lblLanguage.text = "Language      ";
			_txtLanguage.width = 200;
			_hbox1.addChild(_lblLanguage);
			_hbox1.addChild(_txtLanguage);
			
			var _hbox2:HBox = new HBox();			
			_lblExpr.text = "Expression     ";
			_txtExpr.width = 200;
			_hbox2.addChild(_lblExpr);
			_hbox2.addChild(_txtExpr);
			
			var _hbox3:HBox = new HBox();			
			_lblHandlerClass.text = "Handler Class";
			_txtHandlerClass.width = 200;
			_hbox3.addChild(_lblHandlerClass);
			_hbox3.addChild(_txtHandlerClass);
			
			var _vbox:VBox = new VBox();
			_vbox.addChild(_hbox);
			_vbox.addChild(_hbox1);
			_vbox.addChild(_hbox2);
			_vbox.addChild(_hbox3);
			this.addChild(_vbox);
		}
		public function get expr():String{
			return _txtExpr.text;
		}
		public function set expr(p_expr:String):void{
			_txtExpr.text = p_expr;
		}
		public function get title():String{
			return _txtTitle.text;
		}
		public function set title(p_title:String):void{
			_txtTitle.text = p_title;
		}
	}
}